package towerDefense;

import javax.swing.JFrame;

import utilities.Painter;

/**
 * Class to test all methods are working properly and provide a testbed for ideas
 * and see any possible bugs or ways to cheat the game.  
 * 
 * @author Guillermo Mendez-Kestler
 *
 */
class AAA_Tester {

	/**
	 * Main method to test. 
	 * @param args None available. 
	 */
	public static void main(String[] args) {
		Player player = new Player(750);
		System.out.println("player credits: "+player.getCredits());
		printObjs();
		System.out.println("Building Tower");
		player.buyTower(0);
		printObjs();
		System.out.println("Building Tower");
		player.buyTower(0, 15, 15, 10);
		printObjs();
		System.out.println("Current Tower Level: "+World.getTowers()[0].getTowerLevel());
		System.out.println("Upgrading Tower");
		player.upgradeTower(World.getTowers()[0]);
		System.out.println("Current Tower Level: "+World.getTowers()[0].getTowerLevel());
		System.out.println("player credits: "+player.getCredits());
		
		Enemy_Basic myEnemy = new Enemy_Basic(52, 205);
		System.out.println(myEnemy.getSpace().toString());
		printObjs();


		/*
		System.out.println("player credits: "+player.getCredits());

		System.out.println("Upgrading Tower - Cost: "+tb.BUILD_COST);
		tb.upgradeTower();
		System.out.println("player credits: "+player.getCredits()+" - Tower Level "+tb.TOWER_LEVEL);

		System.out.println("Upgrading Tower - Cost: "+tb.BUILD_COST);
		tb.upgradeTower();
		System.out.println("player credits: "+player.getCredits()+" - Tower Level "+tb.TOWER_LEVEL);

		System.out.println("Upgrading Tower - Cost: "+tb.BUILD_COST);
		tb.upgradeTower();
		System.out.println("player credits: "+player.getCredits()+" - Tower Level "+tb.TOWER_LEVEL);

		System.out.println("Upgrading Tower - Cost: "+tb.BUILD_COST);
		tb.upgradeTower();
		System.out.println("player credits: "+player.getCredits()+" - Tower Level "+tb.TOWER_LEVEL);

		printObjs();
		System.out.println("Tower Location Before: "+tb.X_COORD+","+tb.Y_COORD);
		tb.moveObject(56, 56);
		System.out.println("Tower Location After: "+tb.X_COORD+","+tb.Y_COORD);
		printObjs();
		//*/

		/**
		 * DRAW EVERYTHING ON THE SCREEN.
		 */ 
		JFrame frame = new JFrame();
		frame.setSize(World.MAP_WIDTH, World.MAP_HEIGHT);
		frame.setTitle("Paint");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		Painter paint = new Painter();
		frame.add(paint);
		frame.setVisible(true);

	}

	/**
	 * quick method to print objects in the world. 
	 */
	public static void printObjs(){
		System.out.println("Printing all world objects and locations");
		T_Object[] objs = World.getObjects();
		for(T_Object obj:objs){
			System.out.println(obj+"\n\t- centered at: ("+obj.getX()+","+obj.getY()+")"+
					"\n\t- Tower Coordinates Min X,Y: ("+obj.getSpace().getMinX()+","+obj.getSpace().getMinY()+")"+
					"\n\t- Tower Coordinates Max X,Y: ("+obj.getSpace().getMaxX()+","+obj.getSpace().getMaxY()+")"+
					"\n\t- Tower Coordinates upper left corner X,Y: ("+obj.getSpace().getX()+","+obj.getSpace().getY()+")");
		}
	}
}
